<?php
class Sms_model extends CI_Model {

	function __construct(){
		parent::__construct();
		$this->url="http://localhost/sms_saf/kirim_sms.php";
		$this->url_email="http://safjogja.org/email_saf/kirim_email.php";
	}
	
	function kirim_sms($no_hp,$pesan){
		$ch = curl_init($this->url);

		$nvp = "&no_hp=".$no_hp."&sms=".$pesan;
		//curl_setopt($ch, CURLOPT_COOKIE, session_name() . '=' . session_id());
		curl_setopt($ch, CURLOPT_POSTFIELDS, $nvp);
		//curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt'); // set cookie file to given file
		//curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookies.txt'); 
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

		$respon= curl_exec($ch);
		//$data=array('isi_pesan'=>$pesan);
		//$insert=$this->db->insert('coba_sms',$data);
		//return $respon;
	}
	function kirim_email($email,$pesan){
		$ch = curl_init($this->url_email);
		
		$nvp = "&alamat_email=".$email."&pesan=".$pesan;
		//curl_setopt($ch, CURLOPT_COOKIE, session_name() . '=' . session_id());
		curl_setopt($ch, CURLOPT_POSTFIELDS, $nvp);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

		$respon= curl_exec($ch);
		//return $respon;
	}
}